package model

import (
    "time"
)

// Donation 捐款记录模型
type Donation struct {
    ID            uint64    `gorm:"primaryKey"`
    ProjectID     uint64    `gorm:"not null;index:idx_project_user"`
    UserID        uint64    `gorm:"not null;index:idx_project_user"`
    Amount        float64   `gorm:"type:decimal(12,2);not null"`
    PaymentMethod int8      `gorm:"type:tinyint;not null"`
    PaymentStatus int8      `gorm:"type:tinyint;default:0"`
    OrderNo       string    `gorm:"type:varchar(32);uniqueIndex"`
    Message       string    `gorm:"type:varchar(255)"`
    IsAnonymous   bool      `gorm:"default:false"`
    CreatedAt     time.Time `gorm:"autoCreateTime;index"`
    UpdatedAt     time.Time `gorm:"autoUpdateTime"`

    // 关联
    Project Project `gorm:"foreignKey:ProjectID"`
    User    User    `gorm:"foreignKey:UserID"`
}